package com.bill.app.serveur;


import java.io.*;
import java.net.Socket;
import java.util.*;

class ServMessagerie extends Thread
{

    ServMessagerie(Socket paquet, Hashtable LesConnecter, Vector listeLogin, String mess)
        throws Throwable
    {
        this.paquet = null;
        ecriture = null;
        this.LesConnecter = null;
        this.listeLogin = null;
        this.paquet = paquet;
        StringTokenizer t = new StringTokenizer(mess, ":");
        t.nextToken();
        expediteur = t.nextToken().trim();
        this.LesConnecter = LesConnecter;
        this.listeLogin = listeLogin;
        ecriture = new PrintWriter(new BufferedWriter(new OutputStreamWriter(paquet.getOutputStream())), true);
        start();
    }

    public void run()
    {
        try
        {
            LesConnecter.put(expediteur, ecriture);
            listeLogin.add(expediteur);
        }
        catch(Throwable e)
        {
            e.printStackTrace();
        }
        Thread.yield();
    }

    Socket paquet;
    String expediteur;
    PrintWriter ecriture;
    Hashtable LesConnecter;
    Vector listeLogin;
}
